import {createBrowserRouter} from "react-router-dom";
import Layout from "../pages/Layout";
import Login from "../pages/Login";
import AuthRoute from "@/components/AuthRoute";
import {lazy, Suspense} from "react";
// import Home from "@/pages/Home";
// import Article from "@/pages/Article";
// import Publish from "@/pages/Publish";

const Publish = lazy(() => import("@/pages/Publish"))
const Home = lazy(() => import("@/pages/Home"))
const Article = lazy(() => import("@/pages/Article"))


export default createBrowserRouter([
    {
        path: '/',
        element: <AuthRoute><Layout/></AuthRoute>,
        children: [
            {
                path: '/',
                element: <Suspense fallback={'loading...'}><Home/></Suspense>
            },
            {
                path: 'article',
                element: <Suspense fallback={'loading...'}><Article/></Suspense>
            },
            {
                path: 'publish',
                element: <Suspense fallback={'loading...'}><Publish/></Suspense>
            },
        ]
    },
    {
        path: '/login',
        element: <Login/>
    }
])